package flc.ast.activity;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;

import android.os.Bundle;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;

import java.util.ArrayList;
import java.util.List;

import flc.ast.BaseAc;
import flc.ast.R;
import flc.ast.adapter.AlbumAdapter;
import flc.ast.databinding.ActivityAlbumBinding;

public class AlbumActivity extends BaseAc<ActivityAlbumBinding> {

    private AlbumAdapter albumAdapter;

    @Override
    protected int onCreate() {
        return R.layout.activity_album;
    }

    @Override
    protected void initView() {
        mDataBinding.ivAlbumBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
        mDataBinding.rvAlbumList.setLayoutManager(new GridLayoutManager(mContext,2));
        albumAdapter=new AlbumAdapter();
        mDataBinding.rvAlbumList.setAdapter(albumAdapter);
        albumAdapter.setOnItemClickListener(this);
    }

    @Override
    protected void onItemClickCallback(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {
        DrawActivity.type=1;
        DrawActivity.img=albumAdapter.getItem(position);
        startActivity(DrawActivity.class);
    }

    @Override
    protected void initData() {
        List<Integer> list=new ArrayList<>();
        list.add(R.drawable.h1);
        list.add(R.drawable.h2);
        list.add(R.drawable.h3);
        list.add(R.drawable.h4);
        list.add(R.drawable.h5);
        list.add(R.drawable.h6);
        list.add(R.drawable.h7);
        list.add(R.drawable.h8);
        list.add(R.drawable.h9);
        list.add(R.drawable.h10);
        list.add(R.drawable.h11);
        list.add(R.drawable.h12);
        list.add(R.drawable.h13);
        list.add(R.drawable.h14);
        list.add(R.drawable.h15);
        list.add(R.drawable.h16);
        list.add(R.drawable.h17);
        list.add(R.drawable.h18);
        list.add(R.drawable.h19);
        list.add(R.drawable.h20);
        albumAdapter.setList(list);
    }
}